/*
 * @Description  : 
 * @Author       : 陈韵同
 * @Date         : 2021-03-02 14:15:24
 * @LastEditTime : 2021-03-22 14:49:55
 * @LastEditors  : 陈韵同
 * @FilePath     : e:\协同云组件库\新建文件夹 (2)\cloud-components\jest.config.js
 */
module.exports = {
  preset: "@vue/cli-plugin-unit-jest",
  moduleFileExtensions: ["js", "jsx", "json", "vue"],
  transform: {
    "^.+\\.vue$": "vue-jest",
    ".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$":
      "jest-transform-stub",
    "^.+\\.jsx?$": "babel-jest",
  },
  moduleNameMapper: {
    "^@/(.*)$": "<rootDir>/src/$1",
    "cloud-components(.*)$": "<rootDir>/packages/$1"
  },
  transformIgnorePatterns: ["<rootDir>/node_modules/(?!(cloud-common|ant-design-vue)/)"],
  snapshotSerializers: ["jest-serializer-vue"],
  setupFiles: ["<rootDir>/tests/unit/lib/register-context.js"],
  testMatch: [
    "**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)",
  ],
  testURL: "http://localhost/",
  collectCoverage: true,
  coverageDirectory: './docs/unit-test-coverage',
  verbose: true,
  collectCoverageFrom: [
    "packages/**/*.{js,ts,vue}",
    "!packages/cloud-upload/*.{js,ts,vue}",
    "!packages/cloud-double-upload/*.{js,ts,vue}",
    "!packages/cloud-navTabs/*.{js,ts,vue}",
    // "packages/cloud-pagination/*.vue",
    "!src/App.vue", // 入口文件排除
    "!src/main.js", // 设置文件排除
    "!src/router/index.js",
    "!**/node_modules/**",
  ],
};
